package com.yuntian.controller;


import com.yuntian.service.DepartmentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 部门控制器
 * @author yuntian
 */
@Controller
@RequestMapping("/department")
@RequiredArgsConstructor
public class DepartmentMasterController {

    private final DepartmentService departmentService;

    /**
     * 获取所有部门
     * @return 部门列表
     * @author yuntian
     */
    @GetMapping("/form")
    public String getAllDepartments(Model model) {
        model.addAttribute("departments", departmentService.getAllDepartments());
        return "logon";
   }
}
